<!DOCTYPE html>

<html
  xmlns="http://www.w3.org/1999/xhtml"
  >
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="generator" content="pandoc" />
    <link rel="icon" href="img/logo/data-to-viz.ico" />

    <style>
      .myheader {
        background-image: url("https://github.com/holtzy/data_to_viz/raw/master/img/overview_RGG_faded.png");
        min-height: 350px;
        background-size: 100% 100%;

        /* Create the parallax scrolling effect */
        background-attachment: fixed;
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;

        height: 100%;
        width: 100% !important;
      }
      .mytitle {
        text-transform: uppercase;
        font-family: "Montserrat";
        font-size: 200%;
        font-weight: 500;
        letter-spacing: 4px;
      }
    </style>

    <div class="myheader" style="text-align: center">
      <br />
      <a href="http://www.data-to-viz.com"
        ><img
          align="left"
          src="https://github.com/holtzy/data_to_viz/raw/master/img/logo/typo.png"
          style="width: 150px; vertical-align: top; margin-left: 5%"
      /></a>
      <br /><br />
      <br /><br />
      <p class="mytitle">Comparing raper lyrics</p>
      <center>
        <div class="mysubtitle">
          <i
            >A few data analytics ideas from
            <a href="https://www.data-to-viz.com">Data-to-Viz.com</a></i
          >
        </div>
      </center>
      <br /><br />

            <a href="https://www.data-to-viz.com/#portfolioanchor">
        <img class="mylogoheader"
        src=https://github.com/holtzy/data_to_viz/raw/master/img/section/VennSmall.png></a
      >
             <a href="https://www.data-to-viz.com/#portfolioanchor">
        <img class="mylogoheader"
        src=https://github.com/holtzy/data_to_viz/raw/master/img/section/LollipopSmall.png></a
      >
             <a href="https://www.data-to-viz.com/#portfolioanchor">
        <img class="mylogoheader"
        src=https://github.com/holtzy/data_to_viz/raw/master/img/section/WordCloudSmall.png></a
      >
                 </div>

       
    <title>SeveralIndepLists.knit</title>

     <script src="libs/header-attrs-2.27/header-attrs.js"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="libs/bootstrap-3.3.5/css/lumen.min.css" rel="stylesheet" />
<script src="libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
       h1.title {font-size: 38px;}
       h2 {font-size: 30px;}
       h3 {font-size: 24px;}
       h4 {font-size: 18px;}
       h5 {font-size: 16px;}
       h6 {font-size: 12px;}
       code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
       pre:not([class]) { background-color: white }</style>
<script src="libs/navigation-1.1/tabsets.js"></script>
<script src="libs/navigation-1.1/codefolding.js"></script>
<link href="libs/pagedtable-1.1/css/pagedtable.css" rel="stylesheet" />
<script src="libs/pagedtable-1.1/js/pagedtable.js"></script>
<script src="libs/kePrint-0.0.1/kePrint.js"></script>
<link href="libs/lightable-0.0.1/lightable.css" rel="stylesheet" />
<link href="libs/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet" />
<script src="libs/htmlwidgets-1.6.4/htmlwidgets.js"></script>
<link href="libs/wordcloud2-0.0.1/wordcloud.css" rel="stylesheet" />
<script src="libs/wordcloud2-0.0.1/wordcloud2-all.js"></script>
<script src="libs/wordcloud2-0.0.1/hover.js"></script>
<script src="libs/wordcloud2-binding-0.2.1/wordcloud2.js"></script>       <style type="text/css">
      code {
        white-space: pre;
      }
    </style>
    <style type="text/css">
      pre > code.sourceCode { white-space: pre; position: relative; }
      pre > code.sourceCode > span { line-height: 1.25; }
      pre > code.sourceCode > span:empty { height: 1.2em; }
      .sourceCode { overflow: visible; }
      code.sourceCode > span { color: inherit; text-decoration: inherit; }
      div.sourceCode { margin: 1em 0; }
      pre.sourceCode { margin: 0; }
      @media screen {
      div.sourceCode { overflow: auto; }
      }
      @media print {
      pre > code.sourceCode { white-space: pre-wrap; }
      pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
      }
      pre.numberSource code
        { counter-reset: source-line 0; }
      pre.numberSource code > span
        { position: relative; left: -4em; counter-increment: source-line; }
      pre.numberSource code > span > a:first-child::before
        { content: counter(source-line);
          position: relative; left: -1em; text-align: right; vertical-align: baseline;
          border: none; display: inline-block;
          -webkit-touch-callout: none; -webkit-user-select: none;
          -khtml-user-select: none; -moz-user-select: none;
          -ms-user-select: none; user-select: none;
          padding: 0 4px; width: 4em;
          color: #aaaaaa;
        }
      pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
      div.sourceCode
        {   }
      @media screen {
      pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
      }
      code span.al { color: #ff0000; font-weight: bold; } /* Alert */
      code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
      code span.at { color: #7d9029; } /* Attribute */
      code span.bn { color: #40a070; } /* BaseN */
      code span.bu { color: #008000; } /* BuiltIn */
      code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
      code span.ch { color: #4070a0; } /* Char */
      code span.cn { color: #880000; } /* Constant */
      code span.co { color: #60a0b0; font-style: italic; } /* Comment */
      code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
      code span.do { color: #ba2121; font-style: italic; } /* Documentation */
      code span.dt { color: #902000; } /* DataType */
      code span.dv { color: #40a070; } /* DecVal */
      code span.er { color: #ff0000; font-weight: bold; } /* Error */
      code span.ex { } /* Extension */
      code span.fl { color: #40a070; } /* Float */
      code span.fu { color: #06287e; } /* Function */
      code span.im { color: #008000; font-weight: bold; } /* Import */
      code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
      code span.kw { color: #007020; font-weight: bold; } /* Keyword */
      code span.op { color: #666666; } /* Operator */
      code span.ot { color: #007020; } /* Other */
      code span.pp { color: #bc7a00; } /* Preprocessor */
      code span.sc { color: #4070a0; } /* SpecialChar */
      code span.ss { color: #bb6688; } /* SpecialString */
      code span.st { color: #4070a0; } /* String */
      code span.va { color: #19177c; } /* Variable */
      code span.vs { color: #4070a0; } /* VerbatimString */
      code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
            div.sourceCode {
        overflow-x: visible;
      }
          </style>
        <style type="text/css">
      pre:not([class]) {
        background-color: white;
      }
    </style>
           <style type="text/css">
      h1 {
        font-size: 34px;
      }
      h1.title {
        font-size: 38px;
      }
      h2 {
        font-size: 30px;
      }
      h3 {
        font-size: 24px;
      }
      h4 {
        font-size: 18px;
      }
      h5 {
        font-size: 16px;
      }
      h6 {
        font-size: 12px;
      }
      .table th:not([align]) {
        text-align: left;
      }
          </style>
         <link
      rel="stylesheet"
      href="style.css"
      type="text/css"
      
    />
      </head>

  <body>
        <style type="text/css">
      .main-container {
        max-width: 940px;
        margin-left: auto;
        margin-right: auto;
      }
      code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
      }
      img {
        max-width: 100%;
        height: auto;
      }
      .tabbed-pane {
        padding-top: 12px;
      }
      button.code-folding-btn:focus {
        outline: none;
      }
    </style>

     
    <div class="container-fluid main-container">
      <!-- tabsets -->
      <script>
        $(document).ready(function () {
          window.buildTabsets("TOC");
        });
      </script>

      <!-- code folding -->
            <style type="text/css">
        .code-folding-btn {
          margin-bottom: 4px;
        }
      </style>
      <script>
        $(document).ready(function () {
                          window.initializeCodeFolding("hide" === "show");
                });
      </script>
         
                    <div class="fluid-row" id="header">
                        <div class="btn-group pull-right">
              <button
                type="button"
                class="btn btn-default btn-xs dropdown-toggle"
                data-toggle="dropdown"
                aria-haspopup="true"
                aria-expanded="false"
              >
                <span>Code</span> <span class="caret"></span>
              </button>
              <ul class="dropdown-menu" style="min-width: 50px">
                                <li><a id="rmd-show-all-code" href="#">Show All Code</a></li>
                <li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li>
                                </ul>
            </div>

                         </div>
              <br><br><br><br>
<div class="mycontent">






<div class="row">
<div class="col-md-6">
<p>This document gives a few suggestions to analyse a dataset composed
by a few lists of items.<br><br>It considers the lyrics of 2 famous
french rapers (<a href="https://en.wikipedia.org/wiki/Nekfeu">Nekfeu</a>
and <a href="https://en.wikipedia.org/wiki/Booba">Booba</a>) and a
french singer (<a
href="https://en.wikipedia.org/wiki/Georges_Brassens">Georges
Brassens</a>).<br><br>This example dataset has been downloaded from the
<a href="https://www.paroles.net/">Paroles.net website</a> using a
custom script and is available on this <a
href="https://github.com/holtzy/data_to_viz/tree/master/Example_dataset">Github
repository</a>. Seventy five songs are considered.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="co"># Libraries</span></span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="fu">library</span>(hrbrthemes)</span>
<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a><span class="fu">library</span>(kableExtra)</span>
<span id="cb1-5"><a href="#cb1-5" tabindex="-1"></a><span class="fu">library</span>(tm)</span>
<span id="cb1-6"><a href="#cb1-6" tabindex="-1"></a><span class="fu">options</span>(<span class="at">knitr.table.format =</span> <span class="st">&quot;html&quot;</span>)</span>
<span id="cb1-7"><a href="#cb1-7" tabindex="-1"></a><span class="fu">library</span>(proustr)</span>
<span id="cb1-8"><a href="#cb1-8" tabindex="-1"></a></span>
<span id="cb1-9"><a href="#cb1-9" tabindex="-1"></a><span class="co"># Load dataset from github</span></span>
<span id="cb1-10"><a href="#cb1-10" tabindex="-1"></a>data <span class="ot">&lt;-</span> <span class="fu">read.table</span>(<span class="st">&quot;https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/14_SeveralIndepLists.csv&quot;</span>, <span class="at">header=</span><span class="cn">TRUE</span>)</span>
<span id="cb1-11"><a href="#cb1-11" tabindex="-1"></a>to_remove <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="st">&quot;_|[0-9]|</span><span class="sc">\\</span><span class="st">.|function|^id|script|var|div|null|typeof|opts|if|^r$|undefined|false|loaded|true|settimeout|eval|else|artist&quot;</span>)</span>
<span id="cb1-12"><a href="#cb1-12" tabindex="-1"></a>data <span class="ot">&lt;-</span> data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(<span class="sc">!</span><span class="fu">grepl</span>(to_remove, word)) <span class="sc">%&gt;%</span> <span class="fu">filter</span>(<span class="sc">!</span>word <span class="sc">%in%</span> <span class="fu">stopwords</span>(<span class="st">&#39;fr&#39;</span>)) <span class="sc">%&gt;%</span> <span class="fu">filter</span>(<span class="sc">!</span>word <span class="sc">%in%</span> <span class="fu">proust_stopwords</span>()<span class="sc">$</span>word)</span>
<span id="cb1-13"><a href="#cb1-13" tabindex="-1"></a></span>
<span id="cb1-14"><a href="#cb1-14" tabindex="-1"></a><span class="co"># show data</span></span>
<span id="cb1-15"><a href="#cb1-15" tabindex="-1"></a>a <span class="ot">&lt;-</span> data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;booba&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">arrange</span>(word) <span class="sc">%&gt;%</span> <span class="fu">mutate</span>(<span class="at">booba=</span>word) <span class="sc">%&gt;%</span> <span class="fu">select</span>(booba) <span class="sc">%&gt;%</span> <span class="fu">sample_n</span>(<span class="dv">6</span>)</span>
<span id="cb1-16"><a href="#cb1-16" tabindex="-1"></a>b <span class="ot">&lt;-</span> data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;nekfeu&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">arrange</span>(word) <span class="sc">%&gt;%</span> <span class="fu">mutate</span>(<span class="at">nekfeu=</span>word) <span class="sc">%&gt;%</span> <span class="fu">select</span>(nekfeu) <span class="sc">%&gt;%</span> <span class="fu">sample_n</span>(<span class="dv">6</span>)</span>
<span id="cb1-17"><a href="#cb1-17" tabindex="-1"></a>c <span class="ot">&lt;-</span> data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;georges-brassens&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">arrange</span>(word) <span class="sc">%&gt;%</span> <span class="fu">mutate</span>(<span class="at">brassens=</span>word) <span class="sc">%&gt;%</span> <span class="fu">select</span>(brassens) <span class="sc">%&gt;%</span> <span class="fu">sample_n</span>(<span class="dv">6</span>)</span></code></pre></div>
</div>
<div class="col-md-2">
<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;">
booba
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
pâtes
</td>
</tr>
<tr>
<td style="text-align:left;">
riche
</td>
</tr>
<tr>
<td style="text-align:left;">
m’éteindre
</td>
</tr>
<tr>
<td style="text-align:left;">
échec
</td>
</tr>
<tr>
<td style="text-align:left;">
noir
</td>
</tr>
<tr>
<td style="text-align:left;">
complete
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-2">
<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;">
nekfeu
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
temps
</td>
</tr>
<tr>
<td style="text-align:left;">
emprunt
</td>
</tr>
<tr>
<td style="text-align:left;">
corps
</td>
</tr>
<tr>
<td style="text-align:left;">
m’ont
</td>
</tr>
<tr>
<td style="text-align:left;">
nekfeu
</td>
</tr>
<tr>
<td style="text-align:left;">
valeurs
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-2">
<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;">
brassens
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
demande
</td>
</tr>
<tr>
<td style="text-align:left;">
j’ai
</td>
</tr>
<tr>
<td style="text-align:left;">
above
</td>
</tr>
<tr>
<td style="text-align:left;">
posthume
</td>
</tr>
<tr>
<td style="text-align:left;">
valent
</td>
</tr>
<tr>
<td style="text-align:left;">
vague
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="wordcloud" class="section level1">
<h1>Wordcloud</h1>
<hr />
<p>If some words are repeated in the dataset, the first thing to do is
probably to find out what are the most frequent ones. A common way to do
so is to build a <a
href="https://www.data-to-viz.com/graph/wordcloud.html">wordcloud</a>:
each word is written with a size proportionnal to its frequency.</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># The wordcloud 2 library is the best option for wordcloud in R</span></span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="fu">library</span>(wordcloud2)</span>
<span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co"># prepare a list of word (50 most frequent)</span></span>
<span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a>mywords <span class="ot">&lt;-</span> data <span class="sc">%&gt;%</span></span>
<span id="cb2-6"><a href="#cb2-6" tabindex="-1"></a>  <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;nekfeu&quot;</span>) <span class="sc">%&gt;%</span></span>
<span id="cb2-7"><a href="#cb2-7" tabindex="-1"></a>  <span class="fu">select</span>(word) <span class="sc">%&gt;%</span></span>
<span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a>  <span class="fu">group_by</span>(word) <span class="sc">%&gt;%</span></span>
<span id="cb2-9"><a href="#cb2-9" tabindex="-1"></a>  <span class="fu">summarize</span>(<span class="at">freq=</span><span class="fu">n</span>()) <span class="sc">%&gt;%</span></span>
<span id="cb2-10"><a href="#cb2-10" tabindex="-1"></a>  <span class="fu">arrange</span>(freq) <span class="sc">%&gt;%</span></span>
<span id="cb2-11"><a href="#cb2-11" tabindex="-1"></a>  <span class="fu">tail</span>(<span class="dv">50</span>)</span>
<span id="cb2-12"><a href="#cb2-12" tabindex="-1"></a></span>
<span id="cb2-13"><a href="#cb2-13" tabindex="-1"></a><span class="co"># Make the plot</span></span>
<span id="cb2-14"><a href="#cb2-14" tabindex="-1"></a><span class="fu">wordcloud2</span>(mywords, <span class="at">size =</span> <span class="dv">2</span>, <span class="at">minRotation =</span> <span class="sc">-</span>pi<span class="sc">/</span><span class="dv">2</span>, <span class="at">maxRotation =</span> <span class="sc">-</span>pi<span class="sc">/</span><span class="dv">2</span>,</span>
<span id="cb2-15"><a href="#cb2-15" tabindex="-1"></a>         <span class="at">backgroundColor =</span> <span class="st">&quot;white&quot;</span>, <span class="at">color=</span><span class="st">&quot;#69b3a2&quot;</span>)</span></code></pre></div>
<div class="wordcloud2 html-widget html-fill-item" id="htmlwidget-5c183e58e4e06d184294" style="width:672px;height:576px;"></div>
<script type="application/json" data-for="htmlwidget-5c183e58e4e06d184294">{"x":{"word":["années","d'où","dure","faut","faux","feel","j'étais","juge","mettre","ossature","reufs","sors","t'as","vie","when","équipe","cyborg","douceur","frères","hey","know","vrais","noir","sais","tue","mère","veux","anneaux","ezflaun","planète","tuerait","d'un","homme","ouais","qu'on","saturne","tour","above","complete","faire","lyrics","showads","song","be","calling","i'll","j'ai","c'est","you","nekfeu"],"freq":[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,7,7,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,10,11,11,11,12,14,17,25],"fontFamily":"Segoe UI","fontWeight":"bold","color":"#69b3a2","minSize":0,"weightFactor":14.4,"backgroundColor":"white","gridSize":0,"minRotation":-1.570796326794897,"maxRotation":-1.570796326794897,"shuffle":true,"rotateRatio":0.4,"shape":"circle","ellipticity":0.65,"figBase64":null,"hover":null},"evals":[],"jsHooks":{"render":[{"code":"function(el,x){\n                        console.log(123);\n                        if(!iii){\n                          window.location.reload();\n                          iii = False;\n\n                        }\n  }","data":null}]}}</script>
<p>However this type of chart can be <a
href="https://www.data-to-viz.com/graph/wordcloud.html">criticized</a>
since it does not reflect frequencies accurately: long words appear
bigger and comparing size is always complicated. Thus, the techniques
seen in <a
href="https://www.data-to-viz.com/story/OneNumOneCat.html">this page</a>
are strongly advised, and my best choice goes to the lollipop chart.</p>
</div>
<div id="lollipop-chart" class="section level1">
<h1>Lollipop chart</h1>
<hr />
<p>A <a
href="https://www.data-to-viz.com/graph/lollipop.html">lollipop</a>
chart is like a <a
href="https://www.data-to-viz.com/graph/barplot.html">barplot</a>, but
the bar is replaced by a segment and a circle. It gives a lighter
appearance. It is advised to use a horizontal version: words are easier
to read.</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a>data <span class="sc">%&gt;%</span></span>
<span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a>  <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;nekfeu&quot;</span>) <span class="sc">%&gt;%</span></span>
<span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a>  <span class="fu">select</span>(word) <span class="sc">%&gt;%</span></span>
<span id="cb3-4"><a href="#cb3-4" tabindex="-1"></a>  <span class="fu">group_by</span>(word) <span class="sc">%&gt;%</span></span>
<span id="cb3-5"><a href="#cb3-5" tabindex="-1"></a>  <span class="fu">summarize</span>(<span class="at">n=</span><span class="fu">n</span>()) <span class="sc">%&gt;%</span></span>
<span id="cb3-6"><a href="#cb3-6" tabindex="-1"></a>  <span class="fu">arrange</span>(n) <span class="sc">%&gt;%</span></span>
<span id="cb3-7"><a href="#cb3-7" tabindex="-1"></a>  <span class="fu">mutate</span>(<span class="at">word=</span><span class="fu">factor</span>(word, word)) <span class="sc">%&gt;%</span></span>
<span id="cb3-8"><a href="#cb3-8" tabindex="-1"></a>  <span class="fu">tail</span>(<span class="dv">10</span>) <span class="sc">%&gt;%</span></span>
<span id="cb3-9"><a href="#cb3-9" tabindex="-1"></a>  <span class="fu">ggplot</span>( <span class="fu">aes</span>(word, <span class="at">y=</span>n)) <span class="sc">+</span></span>
<span id="cb3-10"><a href="#cb3-10" tabindex="-1"></a>    <span class="fu">geom_segment</span>( <span class="fu">aes</span>(<span class="at">x=</span>word ,<span class="at">xend=</span>word, <span class="at">y=</span><span class="dv">0</span>, <span class="at">yend=</span>n), <span class="at">color=</span><span class="st">&quot;grey&quot;</span>) <span class="sc">+</span></span>
<span id="cb3-11"><a href="#cb3-11" tabindex="-1"></a>    <span class="fu">geom_point</span>(<span class="at">size=</span><span class="dv">3</span>, <span class="at">color=</span><span class="st">&quot;#69b3a2&quot;</span>) <span class="sc">+</span></span>
<span id="cb3-12"><a href="#cb3-12" tabindex="-1"></a>    <span class="fu">coord_flip</span>() <span class="sc">+</span></span>
<span id="cb3-13"><a href="#cb3-13" tabindex="-1"></a>    <span class="fu">theme_ipsum</span>() <span class="sc">+</span></span>
<span id="cb3-14"><a href="#cb3-14" tabindex="-1"></a>    <span class="fu">ggtitle</span>(<span class="st">&quot;10 most frequent words used by Nekfeu&quot;</span>) <span class="sc">+</span></span>
<span id="cb3-15"><a href="#cb3-15" tabindex="-1"></a>    <span class="fu">theme</span>(</span>
<span id="cb3-16"><a href="#cb3-16" tabindex="-1"></a>      <span class="at">panel.grid.minor.y =</span> <span class="fu">element_blank</span>(),</span>
<span id="cb3-17"><a href="#cb3-17" tabindex="-1"></a>      <span class="at">panel.grid.major.y =</span> <span class="fu">element_blank</span>(),</span>
<span id="cb3-18"><a href="#cb3-18" tabindex="-1"></a>      <span class="at">legend.position=</span><span class="st">&quot;none&quot;</span></span>
<span id="cb3-19"><a href="#cb3-19" tabindex="-1"></a>    ) <span class="sc">+</span></span>
<span id="cb3-20"><a href="#cb3-20" tabindex="-1"></a>    <span class="fu">xlab</span>(<span class="st">&quot;&quot;</span>)</span></code></pre></div>
<p><img src="SeveralIndepLists_files/figure-html/unnamed-chunk-6-1.png" width="672" style="display: block; margin: auto;" /></p>
</div>
<div id="venn-diagram" class="section level1">
<h1>Venn diagram</h1>
<hr />
<p>Once the most frequent words are known, it is of interest to know how
many words are common to every lists, and how many are specific to each
artist. The best way to represent this information is to use a <a
href="https://www.data-to-viz.com/graph/venn.html">venn diagram</a>.</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="co">#upload library</span></span>
<span id="cb4-2"><a href="#cb4-2" tabindex="-1"></a><span class="fu">library</span>(VennDiagram)</span>
<span id="cb4-3"><a href="#cb4-3" tabindex="-1"></a></span>
<span id="cb4-4"><a href="#cb4-4" tabindex="-1"></a><span class="co">#Make the plot</span></span>
<span id="cb4-5"><a href="#cb4-5" tabindex="-1"></a><span class="fu">venn.diagram</span>(</span>
<span id="cb4-6"><a href="#cb4-6" tabindex="-1"></a>  <span class="at">x =</span> <span class="fu">list</span>(</span>
<span id="cb4-7"><a href="#cb4-7" tabindex="-1"></a>    data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;booba&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">unlist</span>() ,</span>
<span id="cb4-8"><a href="#cb4-8" tabindex="-1"></a>    data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;nekfeu&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">unlist</span>() ,</span>
<span id="cb4-9"><a href="#cb4-9" tabindex="-1"></a>    data <span class="sc">%&gt;%</span> <span class="fu">filter</span>(artist<span class="sc">==</span><span class="st">&quot;georges-brassens&quot;</span>) <span class="sc">%&gt;%</span> <span class="fu">select</span>(word) <span class="sc">%&gt;%</span> <span class="fu">unlist</span>()</span>
<span id="cb4-10"><a href="#cb4-10" tabindex="-1"></a>    ),</span>
<span id="cb4-11"><a href="#cb4-11" tabindex="-1"></a>  <span class="at">category.names =</span> <span class="fu">c</span>(<span class="st">&quot;Booba&quot;</span> , <span class="st">&quot;Nekfeu&quot;</span> , <span class="st">&quot;Brassens&quot;</span>),</span>
<span id="cb4-12"><a href="#cb4-12" tabindex="-1"></a>  <span class="at">filename =</span> <span class="st">&#39;venn.png&#39;</span>,</span>
<span id="cb4-13"><a href="#cb4-13" tabindex="-1"></a>  <span class="at">output =</span> <span class="cn">TRUE</span> ,</span>
<span id="cb4-14"><a href="#cb4-14" tabindex="-1"></a>          <span class="at">imagetype=</span><span class="st">&quot;png&quot;</span> ,</span>
<span id="cb4-15"><a href="#cb4-15" tabindex="-1"></a>          <span class="at">height =</span> <span class="dv">480</span> ,</span>
<span id="cb4-16"><a href="#cb4-16" tabindex="-1"></a>          <span class="at">width =</span> <span class="dv">480</span> ,</span>
<span id="cb4-17"><a href="#cb4-17" tabindex="-1"></a>          <span class="at">resolution =</span> <span class="dv">300</span>,</span>
<span id="cb4-18"><a href="#cb4-18" tabindex="-1"></a>          <span class="at">compression =</span> <span class="st">&quot;lzw&quot;</span>,</span>
<span id="cb4-19"><a href="#cb4-19" tabindex="-1"></a>          <span class="at">lwd =</span> <span class="dv">1</span>,</span>
<span id="cb4-20"><a href="#cb4-20" tabindex="-1"></a>          <span class="at">col=</span><span class="fu">c</span>(<span class="st">&quot;#440154ff&quot;</span>, <span class="st">&#39;#21908dff&#39;</span>, <span class="st">&#39;#fde725ff&#39;</span>),</span>
<span id="cb4-21"><a href="#cb4-21" tabindex="-1"></a>          <span class="at">fill =</span> <span class="fu">c</span>(<span class="fu">alpha</span>(<span class="st">&quot;#440154ff&quot;</span>,<span class="fl">0.3</span>), <span class="fu">alpha</span>(<span class="st">&#39;#21908dff&#39;</span>,<span class="fl">0.3</span>), <span class="fu">alpha</span>(<span class="st">&#39;#fde725ff&#39;</span>,<span class="fl">0.3</span>)),</span>
<span id="cb4-22"><a href="#cb4-22" tabindex="-1"></a>          <span class="at">cex =</span> <span class="fl">0.5</span>,</span>
<span id="cb4-23"><a href="#cb4-23" tabindex="-1"></a>          <span class="at">fontfamily =</span> <span class="st">&quot;sans&quot;</span>,</span>
<span id="cb4-24"><a href="#cb4-24" tabindex="-1"></a>          <span class="at">cat.cex =</span> <span class="fl">0.6</span>,</span>
<span id="cb4-25"><a href="#cb4-25" tabindex="-1"></a>          <span class="at">cat.default.pos =</span> <span class="st">&quot;outer&quot;</span>,</span>
<span id="cb4-26"><a href="#cb4-26" tabindex="-1"></a>          <span class="at">cat.pos =</span> <span class="fu">c</span>(<span class="sc">-</span><span class="dv">27</span>, <span class="dv">27</span>, <span class="dv">135</span>),</span>
<span id="cb4-27"><a href="#cb4-27" tabindex="-1"></a>          <span class="at">cat.dist =</span> <span class="fu">c</span>(<span class="fl">0.055</span>, <span class="fl">0.055</span>, <span class="fl">0.085</span>),</span>
<span id="cb4-28"><a href="#cb4-28" tabindex="-1"></a>          <span class="at">cat.fontfamily =</span> <span class="st">&quot;sans&quot;</span>,</span>
<span id="cb4-29"><a href="#cb4-29" tabindex="-1"></a>          <span class="at">cat.col =</span> <span class="fu">c</span>(<span class="st">&quot;#440154ff&quot;</span>, <span class="st">&#39;#21908dff&#39;</span>, <span class="st">&#39;#fde725ff&#39;</span>),</span>
<span id="cb4-30"><a href="#cb4-30" tabindex="-1"></a>          <span class="at">rotation =</span> <span class="dv">1</span></span>
<span id="cb4-31"><a href="#cb4-31" tabindex="-1"></a>        )</span></code></pre></div>
<center>
<img src="venn.png" />
</center>
</div>
<div id="note" class="section level1">
<h1>Note</h1>
<hr />
<p>This section needs improvements:</p>
<ul>
<li>introduction of upset plot</li>
<li>same number of word per artist</li>
<li>more ideas to come</li>
</ul>
</div>

          <!-- Insert code for related graphics  -->
          <h1>Going further</h1>
          <hr />
          <p>
            You can learn more about each type of graphic presented in this
            story in the dedicated sections. Click the icon below:
          </p>
                    <a href="https://www.data-to-viz.com/#portfolio">
            <img class="mylogoheader"
            src=https://github.com/holtzy/data_to_viz/raw/master/img/section/VennSmall.png></a
          >
                     <a href="https://www.data-to-viz.com/#portfolio">
            <img class="mylogoheader"
            src=https://github.com/holtzy/data_to_viz/raw/master/img/section/LollipopSmall.png></a
          >
                     <a href="https://www.data-to-viz.com/#portfolio">
            <img class="mylogoheader"
            src=https://github.com/holtzy/data_to_viz/raw/master/img/section/WordCloudSmall.png></a
          >
                       </div>
    </div>
    <section
      id="form"
      style="
        margin-top: 70px;
        padding-bottom: 70px;
        padding-top: 70px;
        background-color: #f8f9fa;
      "
    >
      <div class="container">
        <div style="display: flex; flex-direction: column; align-items: center">
          <h2 style="font-size: 44px" class="text-center">
            Dataviz decision tree
          </h2>
          <p class="text-center" style="max-width: 600px; font-size: 18px">
            <a href="https://www.data-to-viz.com">Data To Viz</a> is a
            comprehensive <b>classification of chart types</b> organized by data
            input format. Get a high-resolution version of our decision tree
            delivered to your inbox now!
          </p>
          <div
            style="
              margin-top: -50px;
              width: 100%;
              display: flex;
              justify-content: center;
            "
          >
            <script
              async
              data-uid="8010f15fd2"
              src="https://prodigious-trailblazer-3628.ck.page/8010f15fd2/index.js"
            ></script>
          </div>
          <br />
          <div class="text-center">
            <img
              class="img-fluid"
              src="../img/poster/poster_small.png"
              alt="High Resolution Poster"
              style="max-width: 400px"
            />
          </div>
        </div>
      </div>
    </section>

     &nbsp;
<hr />
<p style="text-align: center;">A work by <a href="https://github.com/holtzy/">Yan Holtz</a> for <a href="https://data-to-viz.com">data-to-viz.com</a></p>

<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- Add font awesome icons -->
<p style="text-align: center;">
	<a href="https://twitter.com/r_graph_gallery?lang=en" class="fa fa-twitter"></a>
	<a href="https://www.linkedin.com/in/yan-holtz-2477534a/" class="fa fa-linkedin"></a>
	<a href="https://github.com/holtzy/" class="fa fa-github"></a>
</p>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-79254642-3"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-79254642-3');
</script>
<script>
var getOutboundLink = function(url) {
	gtag('event', 'click', {
		'event_category': 'outbound',
		'event_label': url,
		'transport_type': 'beacon',
		'event_callback': function(){document.location = url;}
	});
}
</script>

&nbsp;   
    <script>

      // add bootstrap table styles to pandoc tables
      function bootstrapStylePandocTables() {
        $('tr.header').parent('thead').parent('table').addClass('table table-condensed');
      }
      $(document).ready(function () {
        bootstrapStylePandocTables();
      });

          </script>
       </body>
</html>
